package com.yl.message.service.impl.sendNoticeImpl

import com.alibaba.fastjson.JSONObject
import com.yl.common.control.ResponseBody
import com.yl.message.common.MessageType
import com.yl.message.common.annotation.MsgTypeHandler
import com.yl.message.service.MessageService
import com.yl.message.websocket.WebSocketMessageType
import com.yl.message.websocket.WebSocketServer
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service

@Service
@MsgTypeHandler(MessageType.WEBSOCKET)
class WebsocketMessageServiceImpl(
) : MessageService  {


	companion object {
		private val log = LoggerFactory.getLogger(WebsocketMessageServiceImpl::class.java)!!
	}

	override fun send(config: JSONObject, userId: Long, msgBody: JSONObject): ResponseBody {
		log.info("webSocket推送，userId:{},内容：{}",userId,msgBody.toString())
		return WebSocketServer.sendInfo(userId.toString(), msgBody)
	}
}
